package com.yc.web.feign;

import com.yc.damai.dto.Result;
import com.yc.damai.entity.DmProduct;
import com.yc.damai.entity.DmPromotion;
import com.yc.damai.entity.DmUser;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author navy
 * @company 源辰信息
 * @date 2024/9/24
 * @email haijunzhou@hnit.edu.cn
 */
@Component
@Data
public class OtherActionImpl implements OtherAction{

    // TODO 请将数据保存到 Redis 中
    // TODO 请实现最新商品的查询 : id 降序 10 个商品
    private Map<String,Object> redis = new ConcurrentHashMap<>();

    @Override
    public String other() {
        return "降级的Other";
    }

    @Override
    public List<DmProduct> queryHots() {
        return (List<DmProduct>)redis.get("queryHotsCache");
    }

    @Override
    public String hello(String name) {
        return "你好 " + name;
    }

    @Override
    public int add(int a, int b) {
        return 0;
    }

    @Override
    public String age(int num) {
        return null;
    }

    @Override
    public DmUser resetPwd(DmUser user, String pwd, String repwd) {
        return null;
    }

    @Override
    public DmPromotion getNoBegin() {
        return null;
    }

    @Override
    public Result begin(int pmid) {
        return null;
    }

    @Override
    public Result end(DmPromotion dmPromotion) {
        return null;
    }
}
